#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "NewLanguageTabWidget.h"
#include "Project.h"

QT_BEGIN_NAMESPACE
class QAction;
class QMenu;
class QTabWidget;
class QCheckBox;
QT_END_NAMESPACE

class SymbolView;
class SymbolModel;
class LanguageView;
class LanguageModel;

#define MAX_RECENT_FILES_COUNT 5

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow();

protected:
    void closeEvent(QCloseEvent *event);

private slots:
    void newFile();
    void open();
    bool save();
    bool saveAs();
    void about();
    void documentWasModified();
    void currentTabChanged( int tab_index );
    void openSelectedRecentFile();
    void symbolIndexChanged( const QModelIndex & index );

private:
    void createActions();
    void createMenus();
    void createToolBars();
    void createStatusBar();
    void readSettings();
    void writeSettings();
    bool maybeSave();
    void loadFile(const QString &fileName);
    bool saveFile(const QString &fileName);
    void setCurrentFile(const QString &fileName);
    void saveRecentFileListToSettings(void);
    void updateRecentFileListFromSettings(void);
    QString strippedName(const QString &fullFileName);

    QString currentFile;

    QMenu *fileMenu;
    QMenu *editMenu;
    QMenu *helpMenu;
    QToolBar *fileToolBar;
    QAction *newAct;
    QAction *openAct;
    QAction *saveAct;
    QAction *saveAsAct;
    QAction *exitAct;
    QAction *aboutAct;
    QAction * RecentFilesAction[ MAX_RECENT_FILES_COUNT ];
    QTabWidget *tabWidget;
    SymbolView * symbolView;
    SymbolModel * symbolModel;
    LanguageView * languageView;
    LanguageModel * languageModel;
    NewLanguageTabWidget * languageTab;
    Project * project;
    QString EditedFilename;
    QCheckBox * synchronizedViewCheckBox;
    QModelIndex currentSymbolIndex;
};

#endif
